<template>
    <div>
        <div class="hyhd-item" v-for="(item,index) in data" :key='index' @click="toDetailes(item.id)">
            <p class="hd-title">{{item.title}}</p>
            <p class="hd-cont">{{item.content}}</p>
            <p class="hd-time">{{item.create_time}}</p>
        </div>
    </div>
</template>
<script>
import { format } from '../../public/utils';
export default {
    data () {
        return {
            data:'',
        }
    },

    mounted () {
        this.apiActivity();
    },

    methods: {
        async apiActivity(){
            let {data} = await this.https.get(this.api.apiActivity);
            data.forEach(element => {
                element.create_time = format(element.create_time);
            });
            this.data = data;
        },

        toDetailes(id){
            this.$store.commit('setTitle',"活动详情");
            this.$router.push(`/info/${id}`);
        }
    }

}
</script>
<style lang="less" scoped>
@import url(../../assets/css/member/viewhyhd.less);
</style>


